import request from 'utils/request/request';
import { createTheURL } from 'utils/utils';
import api from 'utils/api'

//获取法定代表人的姓名和身份证号
export async function getLegalPersonInfo(params) {
    let { userWsid } = params
    return request(createTheURL(api.GET_LEGALPERSONINFO, userWsid))
}

//用于查询企业的idttyWsid
export async function getBusinessIdttyWsid(params) {
    let { userWsid } = params
    return request(createTheURL(api.GET_BUSINESSIDTTYWSID, userWsid))
}

//用于上传营业执照发起请求
export async function uploadImgBusinessLicense(params) {
    let { idttyWsid, file  } = params
    let url = api.UPLOAD_BUSINESSLICENSE + idttyWsid + '/files/business-license-file'
    return request(createTheURL(url, 'form-upload'), {
        method: 'post',
        body: file
    })
}

//提交企业实名认证信息进行工商四要素实名认证
export async function submitEnterpriseInfo(params) {
    return request(createTheURL(api.SUBMITENTERPRISEINFO, 'dingtalk-enterprise'), {
        method: 'post',
        body: params
    })
}

//企业营业执照OCR识别
export async function OCRRecognition(params) {
    return request(createTheURL(api.OCRRECOGNITION, 'business-license-ocr'), {
        method: 'post',
        body: params
    })
}
